package com.superf.servlet;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.GenericServlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class ServletDemo2 extends GenericServlet {
	
	
	@Override
	public void init() throws ServletException {
		System.out.println(this.getInitParameter("name"));
	}
	
	@Override
	public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException {
		Enumeration<String> myParams = this.getInitParameterNames();
		while(myParams.hasMoreElements()){
			String key = myParams.nextElement();
			String value = this.getInitParameter(key);
			System.out.println(key + ":" + value);
		}
	}
	
	@Override
	public void destroy() {
		System.out.println("byebye");
	}
}
